xen/arm: during efi boot, improve the check for usable memory
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 14 Jan 2020 23:31:55 +0000 (15:31 -0800)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 15 Jan 2020 17:08:34 +0000 (09:08 -0800)
commitb31666c8912bf18d9eff963b06d856e7e818ff34
tree8b2fe7c21784ef7695dc3d8405f01473dda94401
parentcac57fda01d25c079458a146eefd267e3e72e7fc
xen/arm: during efi boot, improve the check for usable memory

When booting via EFI, the EFI memory map has information about memory
regions and their type. Improve the check for the type and attribute of
each memory region to figure out whether it is usable memory or not.
This patch brings the check on par with Linux v5.5-rc6 and makes more
memory reusable as normal memory by Xen (except that Linux also reuses
EFI_PERSISTENT_MEMORY, which we do not).

Specifically, this patch also reuses memory marked as
EfiLoaderCode/Data, and it uses both Attribute and Type for the check
(Attribute needs to be EFI_MEMORY_WB).

Reported-by: Roman Shaposhnik <roman@zededa.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Acked-by: Julien Grall <julien@xen.org>
xen/arch/arm/efi/efi-boot.h